package com.bigmi.article.feignController;

import com.bigmi.apis.article.ArticleClientIp;
import com.bigmi.article.service.ArticleService;
import com.bigmi.model.article.Dto.ArticleDto;
import com.bigmi.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

//实现fegin远程接口
@RestController
public class ArticleClient implements ArticleClientIp {

    @Autowired
    private ArticleService articleService;

    //保存文章
    @PostMapping("api/v1/article/save")
    public ResponseResult saveArticle(@RequestBody ArticleDto articleDto) {
        return articleService.saveArticle(articleDto);
    }
    //修改文章状态
    @PostMapping("api/v1/article/upDown")
    public ResponseResult upAndDown(@RequestBody Long articleId){
        return articleService.upAndDown(articleId);
    }

    //删除文章
    @PostMapping("api/v1/article/del")
    public ResponseResult del(@RequestBody Long articleId){
        return articleService.del(articleId);
    }
}
